home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / DYN401.ZIP / class / pntrary.d < prev    next >
Text File  |  1996-02-04  |  1KB  |  76 lines

  1.  
  2.  
  3.  
  4. /*                                      
  5.  *
  6.  *      Copyright (c) 1993-1996 Algorithms Corporation
  7.  *      3020 Liberty Hills Drive
  8.  *      Franklin, TN 37067
  9.  *
  10.  *      ALL RIGHTS RESERVED.
  11.  *
  12.  *      
  13.  *      
  14.  */
  15.  
  16.  
  17. #include "array1.h"
  18.  
  19.  
  20. defclass  PointerArray : Array  {
  21.  init:    init_class;
  22. };
  23.  
  24.  
  25. #define TYPE    void *
  26.  
  27.  
  28. static    gIndex_t    _index;
  29.  
  30.  
  31. cvmeth    vNew(unsigned rank, ...)
  32. {
  33.     static    gNewArray_t    cnew = NULL;
  34.     MAKE_REST(rank);
  35.  
  36.     if (!cnew)
  37.         cnew = cmcPointer(Array, gNewArray);
  38.     return cnew(self, AT_PNTR, rank, _rest_);
  39. }
  40.  
  41. ivmeth    void    *vPointerValue(...)
  42. {
  43.     MAKE_REST(self);
  44.     return *((TYPE *) _index(self, _rest_));
  45. }
  46.  
  47. ivmeth    vChangeValue(void *val, ...)
  48. {
  49.     MAKE_REST(val);
  50.     *((TYPE *) _index(self, _rest_)) = val;
  51.     return self;
  52. }
  53.  
  54. static    void    init_class(void)
  55. {
  56.     _index = imcPointer(Array, gIndex);
  57. }
  58.  
  59.  
  60.  
  61.  
  62. /*                                      
  63.  *
  64.  *      Copyright (c) 1993-1996 Algorithms Corporation
  65.  *      3020 Liberty Hills Drive
  66.  *      Franklin, TN 37067
  67.  *
  68.  *      ALL RIGHTS RESERVED.
  69.  *
  70.  *      
  71.  *      
  72.  */
  73.  
  74.  
  75.  
  76.